<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<title>用户中心</title>
		<link href="bootstrap-3.3.5-dist/css/bootstrap.min.css" title="" rel="stylesheet" />
		<link title="" href="css/style.css" rel="stylesheet" type="text/css" />
		<link title="blue" href="css/dermadefault.css" rel="stylesheet" type="text/css" />
		<link title="green" href="css/dermagreen.css" rel="stylesheet" type="text/css" disabled="disabled" />
		<link title="orange" href="css/dermaorange.css" rel="stylesheet" type="text/css" disabled="disabled" />
		<link href="css/templatecss.css" rel="stylesheet" title="" type="text/css" />
		<link rel="stylesheet" type="text/css" href="css/addto.css" />
		<script src="script/jquery.min.js" type="text/javascript"></script>
		<script src="script/jquery.cookie.js" type="text/javascript"></script>
		<script src="bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript"></script>
		<script src="script/main.js"></script>
		<script src="script/md5.min.js"></script>
		<script src="script/new_file.js"></script>
	</head>

	<body>
		<nav class="nav navbar-default navbar-mystyle navbar-fixed-top">
			<div class="navbar-header">
				<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
    </button>
				<a class="navbar-brand mystyle-brand"><span class="glyphicon glyphicon-home"></span></a>
			</div>
			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav">
					<li class="li-border">
						<a class="mystyle-color" href="#">管理控制台</a>
					</li>
				</ul>

				<ul class="nav navbar-nav pull-right">
					<li class="li-border">
						<a href="#" class="mystyle-color">
							<span class="glyphicon glyphicon-bell"></span>
							<span class="topbar-num">0</span>
						</a>
					</li>
					<li class="user_name">
						<a href="#">修改用户名或密码</a>
					</li>
					<li class="dropdown li-border">
						<a href="#" class="dropdown-toggle mystyle-color User_name" data-toggle="dropdown">设置<span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li class="cancellation">
								<a>退出</a>
							</li>
						</ul>
					</li>
				</ul>
			</div>
		</nav>
		<div class="down-main">
			<div class="left-main left-full">
				<div class="sidebar-fold"><span class="glyphicon glyphicon-menu-hamburger"></span></div>
				<div class="subNavBox active">
					<div class="sBox">
						<div class="subNav sublist-down"><span class="title-icon glyphicon glyphicon-chevron-down"></span><span class="sublist-title">用户中心</span>
						</div>
						<ul class="navContent" style="display:block">
							<li>
								<div class="showtitle" style="width:100px;"><img src="img/leftimg.png" />用户管理</div>
								<a href="userInfo_2.html"><span class="sublist-icon glyphicon glyphicon-user"></span><span class="sub-title">用户管理</span></a>
							</li>
							<li>
								<div class="showtitle" style="width:100px;"><img src="img/leftimg.png" />公众号设置</div>
								<a href="code.html"><span class="sublist-icon glyphicon glyphicon-user"></span><span class="sub-title">公众号设置</span></a>
							</li>
						</ul>
					</div>
					<div class="sBox">
						<div class="subNav sublist-up"><span class="title-icon glyphicon glyphicon-chevron-up"></span><span class="sublist-title">代理设置</span></div>
						<ul class="navContent">
							<li class="active">
								<div class="showtitle" style="width:100px;"><img src="img/leftimg.png" />添加代理</div>
								<a href="addto_2.html"><span class="sublist-icon glyphicon glyphicon-user"></span><span class="sub-title">添加代理</span></a>
							</li>
							<li>
								<div class="showtitle" style="width:100px;"><img src="img/leftimg.png" />代理详情</div>
								<a href="details_2.html"><span class="sublist-icon glyphicon glyphicon-user"></span><span class="sub-title">代理详情</span></a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="right-product view-product right-full">
				<div class="container-fluid">
					<div class="manage account-manage info-center">
						<div class="page-header">
							<div class="pull-left">
								<h4>代理管理</h4>
							</div>
						</div>
					</div>
				</div>

				<div class="users-list">
					<div class="list-header">
						<p>用户ID：<input type="number" placeholder="请输入查询ID" class="query-input" /> <input type="button" value="确定" class="but-input" /></p>
						<div class="list-warry">
							<table class="gridtable">
								<thead>
									<tr>
										<th>用户ID</th>
										<th>用户昵称</th>
										<th>用户头像</th>
										<th>广告金</th>
										<th>佣金</th>
										<th>操作</th>
									</tr>
								</thead>
							</table>
							<div class="tcdPageCode">
							</div>
						</div>
						<div class="cover">
							<div class="football">
								<div class="nav-gta">
									<h3></h3><span class="min iconfont icon-guanbi"></span></div>
							</div>
							<!---->
							<div class="football-1">
								<div class="nav-gta">
									<h3></h3><span class="mini-1 iconfont icon-guanbi"></span></div>
								<div class="switch">
									<div class="recharge record">支出纪录</div>
									<div class="spend record">充值记录</div>
								</div>
								<div class="displays-1 gao">
									<ul>
										<li>序号</li>
										<li>支出时间</li>
										<li>支出金额</li>
										<li>类型</li>
									</ul>
								</div>
								<div class="displays-2">
									<ul>
										<li>序号</li>
										<li>充值时间</li>
										<li>充值金额</li>
										<li>状态</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--设置代理账号密码-->
				<div class="setup_1">
					<div class="setAgent">
						<div class="titleNamer">
							<h4>设置代理账号</h4>
						</div>
						<div class="from-warry">
							<p>账号：<input class="dl-input names" type="text" placeholder="请输入设置账号" /></p>
							<p>密码：<input class="dl-input poswd" type="text" placeholder="请输入设置密码" /></p>
							<p><input class="determine" type="button" value="确定" /></p>
						</div>
					</div>
				</div>
				<div class="setup">
						<div class="setAgent">
							<div class="titleNamer">
								<h4>修改密码</h4>
							</div>
							<div class="from-warry">
								<p>旧密码：<input class="dl-input names_2" type="text" placeholder="请输新的账号" /></p>
								<p>新密码：<input class="dl-input poswd_2" type="text" placeholder="请输入新的密码" /></p>
								<p>再次输入：<input type="text" placeholder="请输入新密码" class="confirm" /></p>
								<p><input class="confirm_sbmit" type="button" value="确定修改" /></p>
							</div>
						</div>
					</div>
			</div>
		</div>
		<script src="http://www.lanrenzhijia.com/ajaxjs/jquery.page.js"></script>
		<script type="text/javascript">
			$('.cancellation').on('click', function() {
				$.ajax({
					type: "get",
					url: "/proxy/exitLogin",
					contentType: "application/json; charset=utf-8",
					success: function(res) {
						if(res.error_code == 0) {
							window.location.href = 'login.html';
						}
					}
				});
			})

			$(function() {
				/*换肤*/
				$(".dropdown .changecolor li").click(function() {
					var style = $(this).attr("id");
					$("link[title!='']").attr("disabled", "disabled");
					$("link[title='" + style + "']").removeAttr("disabled");

					$.cookie('mystyle', style, {
						expires: 7
					}); // 存储一个带7天期限的 cookie 
				})
				var cookie_style = $.cookie("mystyle");
				if(cookie_style != null) {
					$("link[title!='']").attr("disabled", "disabled");
					$("link[title='" + cookie_style + "']").removeAttr("disabled");
				}
				/*左侧导航栏显示隐藏功能*/
				$(".subNav").click(function() {
					/*显示*/
					if($(this).find("span:first-child").attr('class') == "title-icon glyphicon glyphicon-chevron-down") {
						$(this).find("span:first-child").removeClass("glyphicon-chevron-down");
						$(this).find("span:first-child").addClass("glyphicon-chevron-up");
						$(this).removeClass("sublist-down");
						$(this).addClass("sublist-up");
					}
					/*隐藏*/
					else {
						$(this).find("span:first-child").removeClass("glyphicon-chevron-up");
						$(this).find("span:first-child").addClass("glyphicon-chevron-down");
						$(this).removeClass("sublist-up");
						$(this).addClass("sublist-down");
					}
					// 修改数字控制速度， slideUp(500)控制卷起速度
					$(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(300);
				})
				/*左侧导航栏缩进功能*/
				$(".left-main .sidebar-fold").click(function() {

					if($(this).parent().attr('class') == "left-main left-full") {
						$(this).parent().removeClass("left-full");
						$(this).parent().addClass("left-off");

						$(this).parent().parent().find(".right-product").removeClass("right-full");
						$(this).parent().parent().find(".right-product").addClass("right-off");

					} else {
						$(this).parent().removeClass("left-off");
						$(this).parent().addClass("left-full");

						$(this).parent().parent().find(".right-product").removeClass("right-off");
						$(this).parent().parent().find(".right-product").addClass("right-full");

					}
				})

				/*左侧鼠标移入提示功能*/
				$(".sBox ul li").mouseenter(function() {
					if($(this).find("span:last-child").css("display") == "none") {
						$(this).find("div").show();
					}
				}).mouseleave(function() {
					$(this).find("div").hide();
				})
			})

			//设置代理账户
			$(function() {
				var uid = '';
				var name = '';
				var passWord = '';
				$('.appoint').on('click', function() {
					//					$('.setup').show();

					console.log(uid)

				});

				//设置代理账号密码
				$('.determine').on('click', function(event) {
					event.stopPropagation();
					name = $('.names').val();
					passWord = $('.poswd').val();
					uid = $('.tdone').html() - 0;
					console.log(uid);
					console.log(passWord)
					console.log(name)
					//					passWord = md5(md5($('.poswd').val()));
					//					console.log("账号"+name+'密码'+passWord)
					if(name.length == 0 || passWord.length == 0) {
						alert('账号密码不能为空！')
					} else {
						$.ajax({
							type: "get",
							url: "/proxy/addAgent",
							contentType: "application/json; charset=utf-8",
							data: {
								'uid': uid,
								'name': name,
								'passWord': passWord
							},
							success: function(res) {
								if(res.error_code == 0) {
									alert('添加成功！');
									window.location.reload();
								} else if(res.error_code == 1) {
									alert(res.data)
								} else if(res.error_code == 2) {
									alert('请求错误！')
								}
							}
						});
					}
				})

				//撤销代理
				$('.revoke').on('click', function() {
					if(confirm('确定要撤销吗？')) {

					} else {
						window.location.reload()
					}
				})

				$('.setup').on('click', function() {
					$('determine.setup').hide();
				});
				$('.setAgent').on('click', function(event) {
					event.stopPropagation();
				})
				$('.but-input').on('click', function() {
					$('tbody').children().remove('tr');
					var uid = $('.query-input').val() - 0;
					var length = $('.query-input').val().length
					if(length !== 0) {
						$.ajax({
							type: "get",
							url:"/proxy/getAgentUser",
							data: {
								'uid': uid
							},
							success: function(res) {
								console.log(res);
								if(res.error_code == 0) {
									var str = '';
									str += '<tr>';
									str += '<td class="tdone">' + res.data.id + '</td>';
									str += '<td>' + res.data.nickName + '</td>';
									str += '<td><img src="' + res.data.headImgUrl + '"/></td>';
									str += '<td>' + res.data.money + '</td>';
									str += '<td>' + res.data.commMoney + '</td>';
									str += '<td><a class="x"><button class="appoint">代理授权</button></a></td>';
									str += '</tr>';
									$('.gridtable').append(str)
								} else if(res.error_code == 1) {
									alert(res.data)
								}

								$('.appoint').on('click', function() {
									$('.setup_1').show()
								})
							}
						})
					}

				})

			})
		</script>
	</body>

</html>
<script src="script/index.js"></script>